package com.analysis.service;

import com.analysis.entity.Company;
import com.analysis.mapper.CompanyMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CompanyService {

    @Autowired
    private CompanyMapper companyMapper;

    public int create(Company company) {
        return companyMapper.insert(company);
    }

    public int delete(Long id) {
        return companyMapper.deleteById(id);
    }

    public int update(Company company) {
        return companyMapper.update(company);
    }

    public Company getById(Long id) {
        return companyMapper.selectById(id);
    }

    public List<Company> listAll() {
        return companyMapper.selectAll();
    }

    public Company getByName(String name) {
        return companyMapper.selectByName(name);
    }
}


